def get_breadcrumb(category):
    """获取面包屑导航"""
    breadcrumb = {
        'cat1': '',
        'cat2': '',
        'cat3': '',
    }

    if category.parent is None:  # 一级类别
        breadcrumb['cat1'] = category

    elif category.subs.count() == 0:  # 三级类别
        breadcrumb['cat3'] = category
        cat2 = category.parent
        breadcrumb['cat2'] = cat2
        breadcrumb['cat1'] = cat2.parent

    else:  # 二级类别
        breadcrumb['cat2'] = category
        breadcrumb['cat1'] = category.parent

    return breadcrumb
